<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserPaperAnswerTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_paper_answer', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_paper_id',false)->default(0)->index()->comment('用户问卷id');
            $table->unsignedBigInteger('paper_id',false)->default(0)->index()->comment('问卷id');
            $table->unsignedBigInteger('question_id',false)->default(0)->comment('题目id');
            $table->string('question_title')->nullable()->comment('题目');
            $table->text('question_answers')->nullable()->comment('选项');
            $table->string('question_right_result',10)->nullable()->comment('正确选项');
            $table->string('answer_txt')->comment('题目回答');
            $table->boolean('is_answer_right')->default(false)->comment('是否答对');
            $table->unsignedTinyInteger('score',false)->default(0)->comment('分数');
            $table->timestamps();
            $table->softDeletes();
            $table->engine='InnoDb';
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_paper_answer');
    }
}
